package org.sample.pack;

import org.sample.commons.io.FileUtils;

import java.io.*;
import java.net.URL;

public class PackHelper2 {


    public static void main(String[] args) throws IOException {
        URL resource = PackHelper2.class.getResource("/files.txt");
        String path = resource.getPath();
        File paths = new File(path);

        FileUtils.eachText(paths, source -> {
            String target;
            if (source.startsWith("D"))
                target = "E" + source.substring(1, source.length());
            else
                target = "D" + source.substring(1, source.length());
            File targetFile = new File(target);
            targetFile.mkdirs();
            targetFile.delete();
            FileUtils.copy(new File(source), targetFile);
            return false;
        });

    }

}